home *** CD-ROM | disk | FTP | other *** search
- // prevent Sage from load pages in locked tabs
- // code by onemen
-
- const OPEN_TAB_FOR_SAGE = "extensions.tabmix.opentabfor.sage";
-
- var TMP_Sage = {
- init: function () {
- eval("updateItemContextMenu ="+updateItemContextMenu.toString().replace(
- 'readStateController.onCommandUpdate();',
- '$& TMP_Sage.buildContextMenu();'
- ));
-
- eval("bookmarksTreeClick ="+bookmarksTreeClick.toString().replace(
- 'const BOOKMARK_SEPARATOR',
- 'var where = TMP_Places.fixWhereToOpen(aEvent, CreateHTML._tabbed ? "tab" : "current", TMP_Sage.openTabPref); \
- CreateHTML.tabbed = where == "tab"; \
- $&'
- ));
-
- eval("bookmarksOpen ="+bookmarksOpen.toString().replace(
- 'getContentBrowser().loadURI(lastResource.url);',
- 'if (CreateHTML._tabbed) getContentBrowser().addTab(lastResource.url); \
- else $&'
- ));
-
- eval("openURI ="+openURI.toString().replace(
- 'switch (windowType)',
- 'windowType = TMP_Places.fixWhereToOpen((oType instanceof Event)? oType : null, !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
- $&'
- ));
-
- },
-
- buildContextMenu: function () {
- var _open = document.getElementById("rssOpenItem");
- var _openInWindow = document.getElementById("rssOpenNewWindowItem");
- var _openInTab = document.getElementById("rssOpenNewTabItem");
- TMP_updateContextMenu(_open, _openInWindow, _openInTab, this.openTabPref);
- },
-
- get openTabPref() {
- var prefSVC = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch2);
-
- if (prefSVC.prefHasUserValue(OPEN_TAB_FOR_SAGE))
- return OPEN_TAB_FOR_SAGE;
- else
- return prefStringTMBookmark;
- }
-
- }
-